

import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class YYBBRefreshHeadWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child:getRefreshHeadWidget(),
    );
  }

  Widget getRefreshHeadWidget(){
    return ClassicHeader(
      idleText: " ",
      refreshingText: " ",
      releaseText: " ",
      completeText: " ",
    );
  }
}


class YYBBRefreshLoadingWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: getLoadMoreFooterWidget(),
    );
  }


  Widget getLoadMoreFooterWidget() {
    return  CustomFooter(
      builder: (BuildContext context,LoadStatus mode){
        Widget body ;
        if(mode == LoadStatus.idle){
          body =  Text(
            "上拉加载",
            style: TextStyle(
              fontSize: 15,
              fontWeight: FontWeight.w600,
              color: Color.fromRGBO(153, 153, 153, 1),
            ),
          );
        }
        else if(mode==LoadStatus.loading){
          body =  CupertinoActivityIndicator();
        }
        else if(mode == LoadStatus.failed){
          body = Text("加载失败！点击重试", style: TextStyle(
            fontSize: 15,
            fontWeight: FontWeight.w600,
            color: Color.fromRGBO(153, 153, 153, 1),
          ),);
        }
        else if(mode == LoadStatus.noMore){
          body = Text("没有更多数据了!", style: TextStyle(
            fontSize: 15,
            fontWeight: FontWeight.w600,
            color: Color.fromRGBO(153, 153, 153, 1),
          ),);
        }
        else{
          body = Text("上拉加载更多", style: TextStyle(
            fontSize: 15,
            fontWeight: FontWeight.w600,
            color: Color.fromRGBO(153, 153, 153, 1),
          ),);
        }
        return Container(
          height: 55.0,
          child: Center(child:body),
        );
      },
    );

  }



}

